package service.impl;

import dao.BookDao;
import dao.impl.BookDaoImpl;
import entity.Book;
import service.BookService;

import java.util.List;

/*
杨威
2021/9/7
21:33
*/
public class BookServiceImpl implements BookService {
    BookDao bookDao=new BookDaoImpl();


    @Override
    public int addBook(Book book) {
        return bookDao.insert(book);
    }

    @Override
    public int deleteBook(int i) {
       return bookDao.delete(i);

    }

    @Override
    public int updateBook(Book book) {
        return bookDao.update(book);

    }

    @Override
    public Book selectById(int i) {
        Book book = bookDao.selectById(i);
        return book;
    }

    @Override
    public List<Book> selectAllBook() {
        List<Book> books = bookDao.selectAll();
        return books;
    }

    @Override
    public long selectCountBook() {
        return bookDao.selectCount();
    }

    @Override
    public List<Book> selectAllOrderByDateBook() {
        List<Book> books = bookDao.selectAllOrderByDate();
        return books;
    }
}
